function validate()
{	
	var numRe = new RegExp("[^0-9]");
	id=document.getElementById("userId").value;
	errId=document.getElementById("errorId");
	errId.innerHTML="";
	pass=document.getElementById("userPass").value;
	errPass=document.getElementById("errorPass");
	errPass.innerHTML="";
	capt=document.getElementById("txtCapt").value;
	errCapt=document.getElementById("errorCaptcha");
	errCapt.innerHTML="";
	invalid=true;
	if(id==null || id=="") {
		errId.innerHTML="ID could not be empty !!!";
		invalid=false;
	}else if(isNaN(id)) {
		errId.innerHTML="ID just is a number !!!";
		invalid=false;
	}else if(numRe.test(id)) {
		errId.innerHTML= "Number is not correct !!!";
		invalid=false;
	}
	if(pass.length<6) {
		errPass.innerHTML="Password must be at least 6 characters !!!";
		invalid=false;
	}
	if(capt.length<4) {
		errCapt.innerHTML="Enter captcha, please !!!";
		invalid=false;
	}
	return invalid;
	
};

$("#userId").focusout(function() {
	var id = $("#userId").val();
	var numRe = new RegExp("[^0-9]");
	if (id == null || id == "") {
		$("#errorId").html("ID could not be empty !!!");
	}else if (isNaN(id)) {
		$("#errorId").html("ID just is a number !!!");
	}else if(numRe.test(id)) {
		$("#errorId").html("Number is not correct !!!");
	}else {
		$("#errorId").html("");
	}
});

$("#userPass").focusout(function(){
	pass = $("#userPass").val();
	if (pass == null || pass == "") {
		$("#errorPass").html("Password could not be empty !!!");		
	}else if (pass.length<6) {
		$("#errorPass").html("Password must be at least 6 characters !!!");
	}else {
		$("#errorPass").html("");	
	}
});

$("#txtCapt").focusout(function() {
	captcha = $("#txtCapt").val();
	if (captcha == null || captcha == "") {
		$("#errorCaptcha").html("Enter captcha, please !!!");
	} else{
		$("#errorCaptcha").html("");
	}
});
